<template>
    <div style="width: 100%">
        <div id="deawer">
            <v-tableTitle :title="$t('wave.savefilter')" :btnConfig="btnConfig" @cancel="cancel" @save="save"></v-tableTitle>
            <div class="detailBox">
                <v-detail ref="detail"></v-detail>
            </div>
            <div class="detailListBox">
                <v-detailList ref="detailList"></v-detailList>
            </div>
        </div>
    </div>

</template>

<script>
import baseMixin from "@/mixins/BaseMixin";
import skipMixin from "@/mixins/SkipMixin";
import tableTitle from "commons/TableTitle";
import detail from "../details/Detail"
import detailList from "../detailsList/DetailList"

export default {
    name: "",
    mixins: [baseMixin, skipMixin],
    data() {
        return {
            newFlag: false,
            routeData: {}
        };
    },
    computed: {
        btnConfig() {
            return [
                {label: this.$t('out.createwave'), certigier: !this.btnPermNameList.includes('WM05010108'), invalid: "save"},
                {label: this.$t('common.return'), certigier: !this.btnPermNameList.includes('WM05010109'), invalid: "cancel"},
            ]
        }
    },
    created() {
    },
    methods: {

        //保存按钮
        async save() {
            let str = ""
            if (this.$route.query.queryPageFlag === "querybulider") {
                str = this.routeData.interactionid
            } else {
                str = this.routeData.filterid
            }

            try {
                let res = await this.$api.post(`/wpFilterCreateWave/${str}/${this.routeData.rtxwavetype}/${this.routeData.rtxexternaltype}/${this.$route.query.queryPageFlag}`, {});
                
                    this.$message.success(res.returnMgr);
                    this.$refs.detailList.detailsFlag = false;
                    this.$refs.detailList.detailNav = "1";
                
            } catch (e) {
                this.$message.error(e)
            }
        },
        //弹框取消
        cancel() {
            this.$store.commit("setRouteData", this.routeData);
            this.$router.go(-1);
        },
    },
    mounted() {
        this.routeData = this.$store.state.routeData;
    },
    watch: {},
    components: {
        "v-tableTitle": tableTitle,
        "v-detail": detail,
        "v-detailList": detailList,
    }
}
</script>

<style scoped>

</style>
